/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.GUI.setting;

import ac.ui.controls.PCLPanel;
import ac.uitls.propertiesOperation;
import java.awt.Component;

/**
 *
 * @author empcl_000
 */
public class dataSetting extends PCLPanel {

    ac.engin.setting.dataSetting c = new ac.engin.setting.dataSetting();
    propertiesOperation po = new propertiesOperation();
    ac.ui.utils u = new ac.ui.utils();

    /**
     * Creates new form company
     */
    public dataSetting() {
        initComponents();
        onLoad();
        monLoad();
    }

    private void monLoad() {
        String[] loadData = c.getSetting();
        jtxt_dateFormt.setText(loadData[0]);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pCLTextFieldBeanInfo1 = new ac.ui.controls.PCLTextFieldBeanInfo();
        jToolBar2 = new javax.swing.JToolBar();
        update_bt = new javax.swing.JButton();
        default_bt = new javax.swing.JButton();
        jtxt_dateFormt = new ac.ui.controls.PCLTextField();
        pCLLabel1 = new ac.ui.controls.PCLLabel();

        jToolBar2.setRollover(true);

        update_bt.setText("bt_update");
        update_bt.setFocusable(false);
        update_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        update_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        update_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                update_btActionPerformed(evt);
            }
        });
        jToolBar2.add(update_bt);

        default_bt.setText("bt_default");
        default_bt.setFocusable(false);
        default_bt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        default_bt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        default_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                default_btActionPerformed(evt);
            }
        });
        jToolBar2.add(default_bt);

        pCLLabel1.setText("jlb_title");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jtxt_dateFormt, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(64, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxt_dateFormt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(215, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void update_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_update_btActionPerformed
        String[] items = {jtxt_dateFormt.getText()};
        u.sendMessage(this, po.getWord("label.saveUpdate"), c.updateSetting(items));

    }//GEN-LAST:event_update_btActionPerformed

    private void default_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_default_btActionPerformed
        // TODO add your handling code here:
        u.sendMessage(this, po.getWord("label.saveUpdate"), c.defSetting());
    }//GEN-LAST:event_default_btActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton default_bt;
    private javax.swing.JToolBar jToolBar2;
    private ac.ui.controls.PCLTextField jtxt_dateFormt;
    private ac.ui.controls.PCLLabel pCLLabel1;
    private ac.ui.controls.PCLTextFieldBeanInfo pCLTextFieldBeanInfo1;
    private javax.swing.JButton update_bt;
    // End of variables declaration//GEN-END:variables
}
